#! /usr/bin/env python

# this script used to change bed format into cis-genome format for retrieve sequences
def bed2cis(file1,file2):
	f = open(file1)
	f2 = open(file2 , 'w')
	print >>f2, '#seq_id	chromosome	start	end	strand'
	lines = f.read().split(os.linesep)[:-1]
	for num, line in enumerate(lines):
		temp = line.split()
		print >>f2, '\t'.join([str(num), temp[0], temp[1], temp[2], '+'])
	f.close()
	f2.close()
	
if __name__ == '__main__':
	import os,sys
	if len(sys.argv) == 1:
		print "usage:python bed2cis.py bedfile cisfile"
	else:
		bed2cis(sys.argv[1], sys.argv[2])
